package com.yingside.game;

public class Vampire extends Enemy{
    private int blood;
    private int maxHp;

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public int getMaxHp() {
        return maxHp;
    }

    public void setMaxHp(int maxHp) {
        this.maxHp = maxHp;
    }

    public Vampire() {
    }

    public Vampire(int type){
        switch(type){
            case 1:
                this.setName("吸血鬼蝙蝠");
                this.setHp(100);
                this.setAttack(10);
                this.setDefence(3);
                this.setBlood(50);
                this.setMoney(65);
                break;
            case 2:
                this.setName("吸血鬼僵尸");
                this.setHp(120);
                this.setAttack(12);
                this.setDefence(6);
                this.setBlood(60);
                this.setMoney(75);
                break;
            case 3:
                this.setName("吸血鬼男爵");
                this.setHp(180);
                this.setAttack(17);
                this.setDefence(10);
                this.setBlood(70);
                this.setMoney(90);
                break;
            case 4:
                this.setName("吸血鬼伯爵");
                this.setHp(200);
                this.setAttack(20);
                this.setDefence(15);
                this.setBlood(80);
                this.setMoney(120);
                break;
        }

        this.setMaxHp(this.getHp());
    }

    @Override
    public void response(Hero h) {
        System.out.println(this.getName() + ",冲向：" + h.getName());

        int hurt = h.injured(this);

        int addBlood = hurt * this.getBlood() / 100 ;

        if(addBlood <= 0){
            addBlood = 1;
        }

        //吸血鬼吸血的最大值不能超过原始血量
        int max = this.getHp() + addBlood;

        if(max >= this.getMaxHp()){
            this.setHp(this.getMaxHp());
        }
        else{
            this.setHp(this.getHp() + addBlood);
        }



        System.out.println("==================" + this.getName() + "==================");
        System.out.println("桀桀桀~~~~吸你的血~~~" + addBlood);
        System.out.println(this.getName() + "当前血量:" + this.getHp());
        System.out.println("==================" + this.getName() + "==================");

    }
}
